package com.xebest.web.controller.restapi;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.xebest.api.dto.DataSourceDTO;
import com.xebest.api.dto.ReceiveMessageDTO;
import com.xebest.api.service.ProductRestService;
import com.xebest.common.base.controller.BaseController;

/**
 * 订单restful接口实现demo
 * @author wufei
 */
@RestController
@RequestMapping("restapi/order")
public class OrderController extends BaseController {
	
	@Autowired
	private ProductRestService rest;

	/**
	 * restful请求接口，返回相应dto
	 * @author wufei
	 */
	@RequestMapping("/postForObject")
	public DataSourceDTO postForObject(){
		DataSourceDTO dto=new DataSourceDTO();
		dto.setUserName("zhuxiaocheng");
		dto=rest.postForObejct(dto);
		return dto;
	}
	
	/**
	 * restful相应接口，返回相应dto
	 * @author wufei
	 */
	@RequestMapping("/postDataSourceDTO")
	public ReceiveMessageDTO postDataSourceDTO(@ModelAttribute DataSourceDTO dataSourceDto) {
		System.out.println("postOForObject："+ dataSourceDto);
		ReceiveMessageDTO dto = new ReceiveMessageDTO();
		dto.setData("返回成功");
		return dto;
	}
}
